<template>
    <div class="wc-homepage mint-header-pa">
        <mt-header fixed :title="dTitle">
            <mt-button slot="right" @click="_navToAdvice" class="feedback">反馈</mt-button>
        </mt-header>
        <vue-scroll :pullDownRefresh="false" :pullUpLoad="false">
            <info></info>
            <div class="hp-swipe">
                <mt-swipe :auto="4000" :show-indicators="false">
                    <mt-swipe-item>
                        <div @click="_navToGonglue()">
                            <div class="img"></div>
                            <span class="tip">亚洲杯官网购票全攻略</span>
                        </div>
                    </mt-swipe-item>
                </mt-swipe>
            </div>
            <div class="hp-navbar">
                <div class="navbar-item" v-for="(item, index) in dNav" :key="index" @click="_navTo(item)">
                    <div :class="item.icon"></div>
                    <div class="text">{{item.title}}</div>
                </div>
            </div>
            <!-- <div class="hp-countdown">
                2018年 FIFA 世界杯<span class="date-time-span">今天</span>开幕
            </div> -->
            <vue-line :isMargin="true"></vue-line>
            <poprank></poprank>
            <vue-line :isMargin="true"></vue-line>
            <winrank></winrank>
            <vue-line :isMargin="true"></vue-line>
            <div class="hp-detail">
                <router-link :to="{name: 'voteresult'}">查看我的预测结果 ></router-link>
            </div>
            <vue-line :isMargin="true"></vue-line>
            <br>
        </vue-scroll>
    </div>
</template>
<script>
import moment from 'moment/moment'
import config from './config'
import info from './components/info'
import poprank from '@/components/poprank'
import winrank from './components/winrank'
// import util from '@/common/util'
export default {
    components: {
        info,
        poprank,
        winrank
    },
    data () {
        return {
            dTitle: this.variable.PROGRAM_NAME,
            dNav: config,
            dTime: moment([2018, 5, 14]).diff(moment(), 'days')
        }
    },
    methods: {
        _navToAdvice () {
            window.location = 'https://worldcup.dmpb.com.cn/advice/';
        },
        _navToGonglue () {
            window.location = 'https://worldcup.dmpb.com.cn/front/strategy1.html?id=26';
        },
        _navToPage (url) {
            this.$router.push({
                path: '/schedule'
            });
        },
        _navTo (item) {
            if (item.curPage) {
                // if (["oJEP8tyAV6dpCFA5BMrRQrxojdnE","oJEP8t7DsejMrxk2IEV9azDwBPMU","oJEP8t0l83UgUhxEYPQlpPsAEVU8","oJEP8t03z5DrCC5X9ochRlh7i2DY","oJEP8t4u9ff49GQnOCEX92WPZg1M","oJEP8t_rnBFzEfuA-fqwDKdWbytA","oJEP8t4EF7Mca7rggqG-y1BayE4I","oJEP8t-27tzRuk2idKyfDxZFEhbA","oJEP8t1M02M8J05yP1y9J7Qpg_WA","oJEP8t8pq5nBTShL_MnfVKDS35D8","oJEP8t1lqs28ugsUZkdTQJ8FK2bc",'oJEP8t3lOErHAb1nHabl21PIJkJU'].indexOf(window.app.openId) > -1) {
                //     this.$router.push('vote');
                // }else{
                //     util.alert('即将上线，敬请期待！');
                // }
                if (window.app.openId) {
                  this.$router.push('vote');
                }else{
                  window.location = "https://worldcup.dmpb.com.cn/";
                }
            }else {
                window.location = item.url + `?v=${new Date().getTime()}`;
            }
        }
    }
}
</script>
<style lang="less" scoped>
    @import './icons.less';
    @import '~assets/less/variable.less';
    .wc-homepage {
        width: 100%;
        height: 100%;
    }
    .hp-swipe {
        display: relative;
        height: 170px;
        .tip {
            position: absolute;
            width: 100%;
            bottom: 0;
            line-height: 2em;
            color: @color-background-white;
            background-color: #0e0b0b;
            opacity: 0.8;
            text-indent: 1em;
        }
        .img{
            width: 100%;
            height: 170px;
            background-image: url('https://wujing123.oss-cn-beijing.aliyuncs.com/match.jpg?x-oss-process=style/mystyle');
            background-repeat: no-repeat;
            background-size: cover;
            background-position: center;
        }
    }
    .hp-navbar {
        margin-top: 25px;
        padding: 0 6px;
        overflow: hidden;
        .navbar-item {
            margin-bottom: 14px;
            float: left;
            width: 25%;
            text-align: center;
            font-size: 12px;
        }
        .text {
            margin-top: 10px;
        }
    }
    .hp-countdown {
        text-align: center;
        width: 95%;
        margin: 10px auto 0;
        box-shadow: 1px 1px 10px #ccc;
        line-height: 2em;
        .date-time-span {
            padding: 0 5px;
            color: #f13426;
            font-size: 25px;
        }
    }
    .hp-detail {
        text-align: center;
        font-size: 14px;
        color: @color-tip-font;
    }
    .feedback {
        color: @color-add-blue;
    }
    .line {
        width: 100%;
        height: 1px;
        margin: 25px 0;
        background-color: @color-line-grey;
    }
</style>

